package org.yi.fc.validator.admin;

import org.yi.fc.entity.FSysUser;

import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;

public class LoginValidator extends Validator {

	@Override
	protected void handleError(Controller controller) {
		controller.keepModel(FSysUser.class);
		
		String actionKey = getActionKey();
		if (actionKey.equals("/admin/login")) {
			controller.render("login.html");
		}
	}

	@Override
	protected void validate(Controller controller) {
		validateRequiredString("username", "username", "用户名不能为空");
		validateRequiredString("passwd", "passwd", "密码不能为空");
	}

}
